# -*- coding: utf-8 -*-
# @Time    : 2022/7/22 23:40
# @Author  : xhf
# @Email   : xhf9309@163.com
# @File    : recipe.py
# @Software: PyCharm
from pages.base_page import BasePage
from selenium.webdriver.common.by import By

class RecipePage(BasePage):
    '''食谱页面类'''
    '''定位器'''
    attention_locator = (By.ID,'com.gfeng.daydaycook:id/iv_focus_status')   #关注定位器
    grocery_shopping_list_locator = (By.ID,'com.gfeng.daydaycook:id/tv_food_material_add')  #买菜清单定位器
    comment_locator = (By.ID,'com.gfeng.daydaycook:id/tv_comment')  #评论定位器
    home_work_locator = (By.ID,'com.gfeng.daydaycook:id/ll_do_homework')    #交作业定位器
    like_locator = (By.ID,'com.gfeng.daydaycook:id/like_layout')     #点赞定位器
    collection_locator = (By.ID,'com.gfeng.daydaycook:id/ll_collection')    #收藏定位器
    send_comment_locator = (By.ID,'	com.gfeng.daydaycook:id/tv_commit')     #发送评论定位器
    likenum_int_locator = (By.ID,'com.gfeng.daydaycook:id/like_textview')   #点赞数定位器
    private_int_fcount_locator = (By.ID,'com.gfeng.daydaycook:id/tv_collection')    #收藏数定位器
    pictures_and_videos_locator = (By.ID,'com.gfeng.daydaycook:id/mTvSetName')  #交作业中图片和视频定位器


    def ele_click_attention(self):
        '''点击关注博主'''
        self.find_element(self.attention_locator).click()

    def assert_text_attention(self):
        '''获取关注按钮的文本'''
        return self.find_element(self.attention_locator).text

    def ele_click_grocery_shopping_list(self):
        '''点击买菜清单'''
        self.find_element(self.grocery_shopping_list_locator).click()

    def ele_click_comment(self):
        '''点击评论'''
        self.find_element(self.comment_locator).click()

    def ele_click_home_work(self):
        '''点击交作业'''
        self.find_element(self.home_work_locator).click()

    def ele_click_like(self):
        '''点击点赞'''
        self.find_element(self.like_locator).click()

    def ele_click_collection(self):
        '''点击收藏'''
        self.find_element(self.collection_locator).click()

    def assert_text_send_comment(self):
        '''获取发送文本的文本内容'''
        return self.find_element(self.send_comment_locator).text

    def assert_likenum_int(self):
        '''获取点赞数量'''
        return self.find_element(self.likenum_int_locator).text

    def assert_private_int_fcount(self):
        '''获取收藏数量'''
        return self.find_element(self.private_int_fcount_locator).text

    def assert_pictures_and_videos(self):
        '''获取交作业文本'''
        return self.find_element(self.pictures_and_videos_locator).text

    def func_click_attention(self):
        '''聚合—点击关注博主'''
        self.ele_click_attention()

    def func_click_comment(self):
        '''聚合—点击评论'''
        self.ele_click_comment()

    def func_click_like(self):
        '''聚合-点击点赞'''
        self.ele_click_like()

    def func_click_homework(self):
        '''聚合-点击交作业'''
        self.ele_click_home_work()

    def func_click_collection(self):
        '''聚合-点击收藏'''
        self.ele_click_collection()